/**
 * Javascript script used to display and hide dynamically top menu elements.
 */

// On page load, call show()) function
window.onload=showMenu;
 
// Display the menu
function showMenu(id,display)
{
	var element = document.getElementById(id);
	// When quitting a menu element
	if (element && !display) 
	{
		// Hide it
		element.style.display='none';
		
		var parent=element.parentNode;
		
		// If it's a submenu, give original colors back to its parent
		if (parent.parentNode.parentNode.parentNode.tagName!='DIV')  //si c'est un sous-menu, on rend à son parent les couleurs d'origine
		{
			parent.firstChild.style.background='#EEEEEE';
		}
	}
	// When hovering a menu element
	else if (element && display)
	{ 
		// Display it
		element.style.display='block';
		
		var parent=element.parentNode;
		
		// If it's a submenu, give hover colors to its parent
		if (parent.parentNode.parentNode.parentNode.tagName!='DIV')
		{
			parent.firstChild.style.background='yellowgreen';
		}
	}
}
